{php include wl_template('common/header');}
<style type='text/css'>
	.goods-info{position:relative;padding-left:60px;}
	.goods-info .img{position:absolute;top:50%;margin-top:-25px;background: url({IMAGE_LOADING}) center center no-repeat;width:50px;height:50px;}
	.goods-info span{white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: block;}
	.all-tips{margin-left: 65px;}
</style>
<ul class="nav nav-tabs" id="myTab">
	<li class="active"><a href="#">开通记录</a></li>
</ul>
<div class="app-content">
	<div class="app-filter">
		<div class="filter-list">
			<form action="" method="get" class="form-horizontal" role="form" id="form1">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="{MODULE_NAME}" />
				<input type="hidden" name="p" value="halfcard" />
				<input type="hidden" name="ac" value="halfcard_web" />
				<input type="hidden" name="do" value="payhalfcardlist" />
				<div class="form-group">
					<label class="col-sm-2 control-label">关键字</label>
					<div class="col-md-3">
						<select name="keywordtype" class="form-control">
							<option value="">关键字类型</option>
							<option value="1" {if $_GPC['keywordtype']==1}selected="selected"{/if}>用户昵称</option>
							<option value="2" {if $_GPC['keywordtype']==2}selected="selected"{/if}>用户电话</option>
							<option value="3" {if $_GPC['keywordtype']==3}selected="selected"{/if}>订单编号</option>
						</select>
                    </div>
                    <div class="col-md-4">
                        <input type="text" name="keyword" class="form-control" value="{$_GPC['keyword']}"  placeholder="请输入关键字"/>
                    </div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">支付时间筛选</label>
					<div class="col-md-2">
						<select name="timetype" class="form-control">
							<option value="">关闭</option>
							<option value="1" {if $_GPC['timetype']==1}selected="selected"{/if}>开启</option>
						</select>
					</div>
					<div class="col-md-2">
						{php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d H:i',$starttime), 'endtime' => date('Y-m-d H:i', $endtime)));}
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label"></label>
					<div class="col-sm-9">
						<button class="btn btn-primary" id="search">筛选</button>
						<button class="btn btn-default" id="output">导出</button>
						<input type="hidden" value="0" name="outflag" id="outflag" />
					</div>
				</div>	
			</form>
		</div>
	</div>
	<div class="app-table-list">
		<div class="panel-body table-responsive collapse in" id="order-template-item-4" style="padding: 0;">
			<table class="table table-bordered">
				<thead style="background-color: #FFFFFF;">
				<tr>
					<th style="width:150px;text-align:center;">用户信息</th>
					<th style="width:150px;text-align: center;">用户电话</th>
					<th style="width:150px;text-align:center;">订单编号</th>
					<th style="width:150px;text-align: center;">所属代理</th>
					<th style="width:100px; text-align:center;">充值时长</th>
					<th style="width:100px; text-align:center;">订单金额</th>
					<th style="width:100px; text-align:center;">结算状态</th>
					<th style="width:110px; text-align: center;">支付时间</th>
				</tr>
				</thead>
				<tbody >
				{loop $pay $y $item}
				<tr>
					<!--一卡通内容-->
					<td class="goods-info line-feed" style="width:150px;padding-left: 10px;height: 60px;">
						<div class="img"><img src="{IMAGE_PIXEL}" class="scrollLoading" data-url="{php echo tomedia($item['avatar'])}" height="50" width="50" ></div>
						<div class="all-tips">
							<p class="" style="font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">{$item['nickname']}</p>
							{if !empty($item['moinfo'])}
							<a class="todetail" orderid = {$item['id']} href="javascript:;">更多信息</a>
							{/if}
						</div>
					</td>
					<!--用户信息-->
					<td class="text-center" style="width:150px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
					{$item['mobile']}
					</td>
					<!--订单编号-->
					<td class="text-center" style="width:150px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
					{$item['orderno']}
					</td>
					<td class="text-center" style="width:150px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
					{$item['agentuser']}
					</td>
					<!--创建时间-->
					<td class="text-center" style="width:100px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">
					{if $item['paytime'] > 1482135700}
					{$item['howlong']}天
					{else}
					{$item['howlong']}个月
					{/if}
					</td>
					<!--核销时间-->
					<td class="text-center" style="width:100px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;" >
					{$item['price']}元
					</td>
					<td class="text-center" style="width:100px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;" >
					{if $item['issettlement']==0}<span class="label label-info">未申请</span>{/if}
					{if $item['issettlement']==1}<span class="label label-info">已结算</span>{/if}
					</td>
					<!--验证码-->
					<td class="text-center" style="width: 110px;">
						{php echo date('Y-m-d H:i:s',$item['paytime'])}
					</td>
				</tr>
				{/loop}
				</tbody>
			</table>
		</div>
		<div class="app-table-foot clearfix">
			<div class="pull-left">
				
			</div>
			<div class="pull-right">
				{$pager}
			</div>
		</div>
	</div>

	<div id="modal-module-gift" class="modal fade" tabindex="-1">
		<div class="modal-dialog" style='width: 920px;'>
			<div class="modal-content" style="overflow: auto;">
				<div class="modal-header">
					<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
					<h2>更多信息</h2>
				</div>
				<div class="modal-body">
					<div id="detail" class="modal-body" style="padding:0;"></div>
				</div>
				<div class="modal-footer" style="padding: 5px 15px;">
					<a class="btn btn-primary js-order-remark-post" data-dismiss="modal" aria-hidden="true">确定</a>
				</div>
			</div>
		</div>
	</div>

</div>
<script type="text/javascript">
    $("#search").click(function(){
		$('#outflag').val(0);
		$('#form1')[0].submit();
    });
	$("#output").click(function(){
		$('#outflag').val(1);
		$('#form1')[0].submit();
	});
    function sandh(asd){
        if ($(asd).val() == 3) {
            $('#keyword').hide();
            $('#howlong').show();
        }else{
            $('#keyword').show();
            $('#howlong').hide();
        }
    }
</script>
<script type="text/javascript">
	require(['jquery', 'util'], function($, util){
		$('.js-copy').each(function(){
			var id=$(this).attr('data-id');
			util.clip($("#js-copy"+id), $(this).attr('data-url'));
		});
	});
</script>
<script type="text/javascript">

	$(function(){
		$('[name="rank_all"]').click(function() {
			var checked = this.checked;
			$('.js-rank').find('input:checkbox').each(function() {
				this.checked = checked;
			});
		});
		$('#export').click(function() {
			if ($('[name="selecttime[start]"]').val() == '') {
				alert('请选择下单时间');
				$(this).focus();
				return false;
			};
			$(this).attr('type', 'submit').submit();
		});
		
		$('.order-rank').each(function(){
			o.rank(this);
		});
		
		//删除用户记录
		$('#de1').delegate('.js-delete','click',function(e){
			e.stopPropagation();
			var order_ids = [];
			var $checks=$('.checkbox:checkbox:checked');
			$checks.each(function() {
				if (this.checked) {
					order_ids.push(this.value);
				};
			});
				var $this = $(this);
				var ids = order_ids;
				//alert(ids);
				
				util.nailConfirm(this, function(state) {
				if(!state) return;
					$.post("{php echo web_url('halfcard/halfcard_web/deleteHalfcardRecord')}", { ids : ids }, function(data){
						if(!data.errno){
						util.tips("删除成功！");
						location.reload();
						};
					}, 'json');
				}, {html: '确认删除?'});
			});
		});
		
//转换日期
	var dt=$('.date1').text().replace(/^\s+|\s+$/g, "");
	var yy=dt.slice(0,4);
	var mm=dt.slice(4,6);
	var dd=dt.slice(6,8);
	var str=(yy+'-'+mm+'-'+dd).toString();
	$('.date1').text(str);

//二级联动切换
$('#sel_parent').click(function(){

if(this.value!=0){
		$('.daterange-date').hide();
		$('#sel_child').hide();
		$(".nickname").removeAttr("style");
		$('.nickname').show();
}
else{
		$('.daterange-date').hide();
		$('.nickname').hide();
		$('#sel_child').hide();	
		$('#sel_child').attr("display","block");
}
//alert(this.value);
//if(this.value==0)
//		$('#sel_child').hide();
})

	$('.todetail').click(function(){
		$("#detail").html('');
		popwin = $('#modal-module-gift').modal();
		var id = $(this).attr('orderid');
		$.ajax({
			url: "{php echo web_url('halfcard/halftype/moreinfo')}&id="+id,
			cache: false
		}).done(function (html) {
			$("#detail").html(html);
		});
	});


</script>
{php include wl_template('common/footer');}